'''
Created on 2014-4-4

@author: festony
'''







class AmebaDiv1:
    def count(self, X):
        U = list(set(X))
        S = U[:]
        
        for ini in U:
            s = ini
            for x in X:
                if x == s:
                    s += x
            if s in S:
                S.remove(s)
        
        return len(S)






class LongLongTripDiv1:
    def isAble(self, N, A, B, D, T):
        paths = []
        for i in range(len(A)):
            if A[i] == 0:
                p = [i]
                curr = B[i]
                paths.append([p, curr])
            elif B[i] == 0:
                p = [i]
                curr = A[i]
                paths.append([p, curr])
        print paths
        fpaths = []
        while paths != []:
            path = paths.pop(0)
            p = path[0]
            curr = path[1]
            if len(p) == len(A):
                fpaths.append(path[0])
                continue
            #print p, curr
            updated = False
            for i in range(len(A)):
                if i in p:
                    continue
                if A[i] == curr:
                    updated = True
                    newp = p[:]
                    newp.append(i)
                    newcurr = B[i]
                    paths.append([newp, newcurr])
                elif B[i] == curr:
                    updated = True
                    newp = p[:]
                    newp.append(i)
                    newcurr = A[i]
                    paths.append([newp, newcurr])
            if updated == False:
                fpaths.append(path[0])
        print paths
        print fpaths
        if fpaths == []:
            return "Impossible"
        paths = []
        for p in fpaths:
            path = []
            cities = [0]
            curr = 0
            for r in p:
                a = A[r]
                b = B[r]
                if a == curr:
                    cities.append(b)
                    curr = b
                elif b == curr:
                    cities.append(a)
                    curr = a
                path.append(r)
                if curr == N-1:
                    paths.append([path[:], cities[:]])
        print paths
        if paths == []:
            return "Impossible"
        t_cities = {}
        for p in paths:
            t = 0
            for r in p[0]:
                t += D[r]
            if t_cities.has_key(t):
                for c in p[1]:
                    t_cities[t].add(c)
            else:
                t_cities[t] = set(p[1])
        print t_cities
        t_roads = {}
        for t in t_cities.keys():
            if not t_roads.has_key(t):
                t_roads[t] = set([])
                
            for c in t_cities[t]:
                for i in range(len(A)):
                    if A[i] == c or B[i] == c:
                        t_roads[t].add(i)
        print t_roads
        t_rl = {}
        for t in t_roads.keys():
            if not t_rl.has_key(t):
                t_rl[t] = set([])
            for r in t_roads[t]:
                t_rl[t].add(D[r])
        print t_rl
        for t in t_rl.keys():
            if t > T:
                continue
            if t == T:
                return "Possible"
            rest = T - t
            if rest % 2 == 1:
                continue
            rest /= 2
            print rest
            facts = sorted(list(t_rl[t]), reverse = True)
            print facts
            for f in facts:
                rest %= f
                print 'r', r
                if rest == 0:
                    return "Possible"
            if rest == 0:
                return "Possible"
        return "Impossible"



l = LongLongTripDiv1()
#N = 6
#A = [0,0,0,1,2,1,2,2,3,4]
#B = [1,2,3,2,3,5,5,4,4,5]
#D = [1,1,1,1,2,1,2,2,3,4]
#T = 10000
N = 3
A = [0, 0, 1]
B = [2, 1, 2]
D = [7, 6, 5]
T = 25

print l.isAble(N, A, B, D, T)









